package com.he.hsdyc.controller;

import com.he.hsdyc.common.constant.ServerProperties;
import com.he.hsdyc.model.msg.ErrorCode;
import com.he.hsdyc.model.msg.Message;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;


@Api(value="ConstantConfigController",description="常量配置管理",tags={"常量配置管理"})
@RestController
@RequestMapping("constant")
public class ConstantConfigController {

    @Autowired
    private ServerProperties serverProperties;
    @Value("${management.oUser}")
    private String oUser;

    @ApiOperation("配置常量测试")                                               //两种方式
    @RequestMapping(value = "testConfig",method = RequestMethod.GET)
    public Message testConfig() {
        System.out.println("=======================成功获取yml中配置的常量1111：oUser:"+serverProperties.getoUser());
        System.out.println("=======================成功获取yml中配置的常量2222：oUser:"+oUser);

        return new Message(ErrorCode.SUCCESS,oUser);
    }


}
